<div class="sectionTitle" xmlns="http://www.w3.org/1999/html">
  <h1>Rate this project!</h1>
</div>
<div class="edge">
  <img src="../../assets/edge.png"></img>
</div>

<% hasRated = false %>
<% ExerciseRating.find_all_by_lecture_id(params[:lecture_id]).each do |rating| %>
    <% if rating.user_id == current_user.id then%>
        <% hasRated = true %>
    <% end %>
<% end %>

<% if hasRated then %>
    <p>Sorry, you've already <b>rated</b> this exercise! Hey, one man one vote ;) </p>
<% else %>
    <%= render 'form' %>
<% end %>

<%= link_to 'Back', exercise_ratings_path %>
